package com.tomato.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDate;
import java.time.LocalDateTime;

@Data
@TableName("todo_setting")
@Schema(description = "待办事项设定实体")
public class TodoSetting {
    public enum Type {
        POMODORO, GOAL
    }

    public enum TimerMode {
        COUNTDOWN, UPTIME, NO_TIMER
    }

    public enum GoalTargetType {
        DURATION, TIMES
    }

    @TableId(type = IdType.AUTO)
    @Schema(description = "主键，自增")
    private Long id;

    @Schema(description = "所属用户 ID")
    private Long userId;

    @Schema(description = "待办标题/名称")
    private String title;

    @Schema(description = "POMODORO=普通番茄钟；GOAL=定目标")
    private Type type;

    @Schema(description = "COUNTDOWN=倒计时；UPTIME=正向计时；NO_TIMER=不计时")
    private TimerMode timerMode;

    @Schema(description = "倒计时总时长，单位：秒；仅 timer_mode=COUNTDOWN 时有效")
    private Integer countdownDuration;

    @Schema(description = "目标截止日期（到天）；仅 type=GOAL 时有效")
    private LocalDate goalDeadline;

    @Schema(description = "目标维度：DURATION=完成时长；TIMES=完成次数；仅 type=GOAL 时有效")
    private GoalTargetType goalTargetType;

    @Schema(description = "目标值：若 goal_target_type=DURATION 则单位秒，=TIMES 则单位次数；仅 type=GOAL 时有效")
    private Integer goalTargetValue;

    @Schema(description = "每次计时结束后的休息时长，单位：秒，默认 5 分钟")
    private Integer restDuration = 300;

    @Schema(description = "本次待办需要循环的轮数，默认 1 轮")
    private Integer cycle = 1;

    @Schema(description = "记录创建时间")
    private LocalDateTime createdAt;

    @Schema(description = "记录最后更新时间")
    private LocalDateTime updatedAt;

    @Schema(description = "记录上传时间")
    private LocalDateTime uploadedAt;
}